
package trabalhotec.Negocios;

import java.sql.Timestamp;
import java.util.Vector;
import trabalhotec.BD.DataUtil;

public class Pesquisa {
    trabalhotec.BD.pesquisa pesq = new trabalhotec.BD.pesquisa();
    public Vector<Vector> pesquisar(String origem,String destino,String data){
        String[] o = new String[2];
        String[] d = new String[2];
        Timestamp databanco = null;
        if(data==null);
        else databanco = DataUtil.obterDataParaBanco(data);
        if(origem==null) o[0] = null;
        else o = origem.split("-");
        if(destino==null) d[0] = null;
        else d = destino.split("-");
        return pesq.listaPesq(o[0], d[0], databanco);
    }
    public Vector<String> pesqResult(String cod){
        Vector<String> v = new Vector<String>();
        v.add((String) pesq.pesqResult(cod).get(0));
        v.add((String) pesq.pesqResult(cod).get(1));
        v.add((String) pesq.pesqResult(cod).get(2));
        v.add(DataUtil.obterDataDoBanco((Timestamp) pesq.pesqResult(cod).get(3)).toString());
        v.add(pesq.pesqResult(cod).get(4).toString());
        return v;
    }
    public Vector<Vector> buscAeros(String aero, String dataini,String datafim){
        return pesq.buscaAero(aero, DataUtil.obterDataParaBanco(dataini),DataUtil.obterDataParaBanco(datafim));
    }
    public Vector<Vector<String>> clientesVoo(String cod){
        return pesq.vooClientes(cod);
    }
    //busctrecho(String aero1,String aero2, Timestamp datapart,Timestamp datacheg){
    public Vector<Vector> buscatrecho(String aero1,String aero2, String datapart,String datacheg){
        return pesq.busctrecho(aero1, aero2, DataUtil.obterDataParaBanco(datapart),DataUtil.obterDataParaBanco(datacheg));
    }
    public Vector<Vector> buscavol(String origem,String destino,String data){
            return pesq.buscavol(origem,destino,DataUtil.obterDataParaBanco(data));
    }
    public void compra(String cod,String cpf){
        
    }
}
